package com.lyc.day1103.demo02;

/**
 * @author ：Xiaochen
 * @date ：Created in 2022/11/3 20:22
 * @description：
 * @modified By：
 * @version:
 */
public class Test02 {
    public static void main(String[] args) {
        Operator o=(arr)->{
            int sum=0;
            for(int b:arr){
                sum+=b;
            }
            return sum;
        };
        fun(o);

    }
    public static void fun(Operator operator){
        int sum1[]={11,12,13,14};
        int sum = operator.getSum(sum1);
        System.out.println("数组中元素的和："+sum);
    }
}
interface Operator{
    public int getSum(int[] arr);
}